<extend name="Public/base" />
 
<block name="body">
    <div class="main-title">
        <h2>编辑商品</h2>
    </div>
    <form action="{:U('')}" method="post" class="form-horizontal" enctype="multipart/form-data">
        <input type="hidden" class="form-control" name="id" id="id" value="{$res['id']}">
        <div class="form-item">
            <label class="item-label">品名</label>
            <div class="controls">
                <input type="text" class="text input-large" name="title" value="{$res['title']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">描述</label>
            <div class="controls">
                <input type="text" class="text input-large" name="des" value="{$res['des']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">价格</label>
            <div class="controls">
                <input type="text" class="text input-large" name="price" value="{$res['price']}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">图片</label>
            <div class="controls">
                <input type="file" name="img" />
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">状态<span class="check-tips">（显示或关闭）</span></label>
            <div class="controls">
            <if condition=" $res['status'] eq '1'">
                <input type="radio"name="status" value="1" checked/>显示
                <input type="radio"name="status" value="0">不显示
            <else/>
                <input type="radio"name="status" value="1" >显示
                <input type="radio"name="status" value="0" checked/>不显示
            </if>

            </div>
        </div>
        
        <div class="form-item">
            <button class="btn submit-btn " type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
    //搜索功能
    $("#search").click(function(){
        var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
        window.location.href = url;
    });
    //回车搜索
    $(".search-input").keyup(function(e){
        if(e.keyCode === 13){
            $("#search").click();
            return false;
        }
    });
    //导航高亮
    highlight_subnav('{:U('Shop/index')}');
    </script>
</block>